package daybook;


import java.util.ResourceBundle;

public final class Resources {
    /**
     * Error Messages
     */
    public static final class ErrorMessages {

        // commodity
        public static final String COMMODITY_NOT_FOUND = "error.message.commodity.not.found";
        public static final String INVALID_COMMODITY_NAME = "error.message.invalid.commodity.name";
        public static final String NEGATIVE_COMMODITY_FRACTION_DIGIT_COUNT = "error.message.negative.commodity.fractionDigitCount";
        public static final String NOT_CURRENCY = "error.message.not.currency";
        public static final String DUPLICATED_COMMODITY_NAME = "error.message.duplicated.commodity.name";
        public static final String INVALID_COMMODITY_FRACTION = "error.message.invalid.commodity.fraction";
        // account
        public static final String ACCOUNTS_NOT_FOUND = "error.message.accounts.not.found";
        public static final String ACCOUNT_NOT_FOUND = "error.message.account.not.found";
        public static final String ACCOUNT_NOT_FOUND_BY_CODE = "error.message.account.not.found.by.code";
        public static final String INVALID_ACCOUNT_TYPE = "error.message.invalid.account.type";
        public static final String DUPLICATED_ACCOUNT_CODE = "error.message.duplicated.account.code";
        public static final String HAVING_TYPE_FOR_SUB_ACCOUNT = "error.message.having.type.for.sub.account";
        public static final String MISSING_TYPE_FOR_TOP_LEVEL_ACCOUNT = "error.message.missing.type.for.top.level.account";
        // book
        public static final String INVALID_ACCOUNT_NAME_SEPARATOR = "error.message.invalid.account.name.separator";
        public static final String MISSING_DEFAULT_CURRENCY = "error.message.missing.default.currency";
        // transaction
        public static final String UNORDERED_TRANSACTIONS = "error.message.unordered.transactions";
        public static final String UNBALANCED_TRANSACTION = "error.message.unbalanced.transaction";
        public static final String HAVING_LESS_THAN_TWO_ENTRIES = "error.message.having.less.than.two.entries";
        public static final String INVALID_COSTS_AND_COUNTS = "error.message.invalid.costs.and.counts";
        public static final String SHOULD_NOT_HAVE_COSTS_AND_COUNTS = "error.message.should.not.have.costs.and.counts";
        public static final String NEGATIVE_COUNT = "error.message.negative.count";
        public static final String NEGATIVE_COST = "error.message.negative.cost";
        // config & runner
        public static final String INVALID_CASH_FLOW_ACCOUNTS = "error.message.invalid.cashflow.accounts";
        public static final String INVALID_EXPRESSION = "error.message.invalid.expression";
        public static final String INVALID_ACCOUNT_EXPRESSION = "error.message.invalid.account.expression";
        public static final String INVALID_TEMPORAL_UNIT = "error.message.invalid.temporal.unit";
        // transaction parser
        public static final String UNEXPECTED_COMMODITY = "error.message.unexpected.commodity";
        public static final String INVALID_DATE = "error.message.invalid.date";
    }

    /**
     * Usages
     */
    public static final class Usages {
        public static final String COMMAND_BOOK = "usage.command.book";
        public static final String COMMAND_GENERATE = "usage.command.generate";
        public static final String CONFIG_FILE = "usage.config.file";
        public static final String OUTPUT_DIRECTORY = "usage.output.directory";
        public static final String COMMAND_INIT = "usage.command.init";
        public static final String INIT_DIRECTORY = "usage.init.directory";
        public static final String BOOK_FILE = "usage.book.file";
        public static final String TRANSACTIONS_FILE  = "usage.transactions.file";
        public static final String LOG_LEVEL = "usage.log.level";
        public static final String INPUT_FORMAT = "usage.input.format";
        public static final String COMMAND_PRINT = "usage.command.print";
        public static final String COMMAND_RUN = "usage.command.run";
        public static final String JAVASCRIPT_FILES = "usage.javascript.files";
        public static final String COMMAND_SHELL = "usage.command.shell";
        public static final String COMMAND_STATUS = "usage.command.status";
        public static final String COMMAND_TAGS = "usage.command.tags";
        public static final String OUTPUT_FORMAT = "usage.output.format";
        public static final String NEGATE_ACCOUNTS = "usage.negate.accounts";
        public static final String ACCOUNTS = "usage.accounts";
        public static final String START_DATE = "usage.start.date";
        public static final String END_DATE = "usage.end.date";
        public static final String HELP = "usage.help";
    }

    /**
     * Templates
     */
    public static final class Templates {
        public static final String STRING_STATISTICS = "template.string.statistics";
        public static final String STRING_BOOK = "template.string.book";
        public static final String STRING_LEDGER = "template.string.ledger";
        public static final String STRING_BALANCE_SHEET = "template.balance.sheet";
        public static final String STRING_INCOME_STATEMENT = "template.string.income.statement";
        public static final String STRING_CASH_FLOW = "template.string.cash.flow";
        public static final String STRING_INVENTORY = "template.string.inventory";
    }

    private Resources() {}

    public static final String RESOURCES_NAME = "Resources";
    public static final ResourceBundle RESOURCES = ResourceBundle.getBundle(RESOURCES_NAME);

    public static String get(String key) {
        return RESOURCES.getString(key);
    }
}
